package top.swle.austers.mapper;


import org.apache.ibatis.annotations.*;
import top.swle.austers.bean.User;
import org.springframework.stereotype.Repository;

@Repository
@Mapper
public interface UserMapper {
    @Select("SELECT * FROM info WHERE USERNAME = #{username}")
    User findByName(@Param("username") String username);

    @Insert("INSERT INTO info(TRUE_NAME,PHONENUMBER,PASSWORD) VALUES(#{true_name},#{phonenumber},#{password})")
    void insertByUser(User user);

    @Select("SELECT * FROM info WHERE phonenumber = #{phonenumber}")
    User findByPhonenumber(@Param("phonenumber") String phonenumber);

    @Update("UPDATE info SET isstudent = #{isStudent} WHERE phonenumber = #{phonenumber}")
    void update(User user);

}
